Python is a dynamically typed language and is normally interpreted. It is object-oriented but has some functional features such as map, reduce, and lambda functions. All functions in Python are Parametrically Polymorphic (see my article Types and Programming Languages for details), which creates difficulties for efficient compilation.
Psyco is a compiler for Python. It is a just-in-time compiler, and uses the run-time type usage information to determine which functions should be native-compiled. It is a specializing compiler -- it will create multiple instantiations of the same function with different type parameters. It is very easy to use; just add 2 lines to the top of your program:
import psyco psyco.full()It is an experimental project. The documentation warns that map and lambda perform poorly, and that list comprehensions (often a reasonable substitute) should be used instead. The original developer has moved on to work on the PyPy project; I should investigate that later.
Compared to other tested languages the performance of uncompiled Python is average; with Psyco compilation it is surprisingly good.
See previous for details of test environment. Same test as before, but only a single core and 1/4 the work.
Psyco psyco-1.6-linux.i386-2.5 from SourceForge
Erlang Haskell Scala MLton_SML Python Psyco 93 22 10 1.5 40 5.5All times in seconds.